package com.itfreer.form.service.metadata;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.itfreer.form.api.BaseRestService;
import com.itfreer.form.api.BaseService;
import com.itfreer.form.entity.metadata.DictionaryEntity;
import com.itfreer.form.service.metadata.DictionaryService;

/**
 * 定义书签功能接口
 */
@Component
@Path("/dictionary/")
public class RestDictionaryService extends BaseRestService<DictionaryEntity> {
	
	@Autowired
	private DictionaryService dictionaryService;

	@Override
	protected BaseService<DictionaryEntity> getService() {
		return dictionaryService;
	}
	
	@POST
	@Path("/getEntitys/{id:.+}")
	@Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)
	public List<DictionaryEntity> getEntitysByID(@PathParam("id") String dicName) {
		return dictionaryService.getEntitys(dicName);
	}
	
	/**
	 * 指量删除实体
	 * 
	 * @param guid
	 *            唯一值集
	 */
	@DELETE
	@Path("/deletesex/{dn:.+}/{ids:.+}")
	@Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)
	public void deletes(@PathParam("dn") String dn, @PathParam("ids") String guids) {
		dictionaryService.deletes(dn, guids);
	}

	@Override
	protected String getServiceName() {
		return "dictionary";
	}
}